package shujvjiegou.week8;



/**
 * @Author JetZhang
 * @Date 2021/10/29
 */
public class BiTree {
 /*   private BitTreeNode root;

     public BiTree(String[] str) {
//        String s = ;
       while (true) {
            if (!str[index].equals("None")) {
                root = new BitTreeNode(str[index++]);
                try {
                    data_root.lChild = new BitTreeNode(str[2 * index]);
                    data_root.rChild = new BitTreeNode(str[2 * index + 1]);
                } catch (IndexOutOfBoundsException e) {
                    data_root.lChild = new BitTreeNode(str[index]);
                    data_root.rChild = new BitTreeNode(str[index]);
                }
//            try {
//                root = new BitTreeNode(s, new BitTreeNode(str[2 * index]), new BitTreeNode(str[2 * index + 1]));
//                data_root.lChild = new BiTree(str).root;
//                data_root.rChild = new BiTree(str).root;
//            } catch (IndexOutOfBoundsException e) {
//                root = new BitTreeNode(s);
//                data_root.lChild = new BiTree(str).root;
//                data_root.rChild = new BiTree(str).root;
//            }
            } else {
                try {
                    root = null;
                }catch (IndexOutOfBoundsException e){
                    root = null;
                }
            }
            index++;
            if (index == str.length)
                break;
        }

    }

    public BiTree(BitTreeNode root) {
        this.root = root;
    }

    public BiTree() {
        this.root = null;
    }

    public void preRootTraverse(BitTreeNode T) {
        if (T != null) {
            System.out.print(T.data);
            preRootTraverse(T.lChild);
            preRootTraverse(T.rChild);
        }
    }

    public int getDepthi1(BitTreeNode T) {
        if (T == null)
            return 0;
        else if (T.lChild == null && T.rChild == null)
            return 1;
        else
            return 1 + (getDepthi1(T.lChild) > getDepthi1(T.rChild) ? getDepthi1(T.lChild) : getDepthi1(T.rChild));
    }

*/
}
